package com.rd.student.jiaji.class3.zhangshixuan.Day0731;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo04 {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        for (int i = 0; i < 50; i++) {
            list.add(i);
        }
        ArrayList<Integer> allList = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            allList.add((Integer) list.get(i));
        }
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要随机的个数：");
        int n = scanner.nextInt();
        System.out.println(allList.size());
        //问题.
        for (int i = 0; i < n; i++) {
            int random = (int) (Math.random() * allList.size());
            System.out.println(allList.get(random));
            System.out.println("随机并移除" + allList.get(random));
            allList.remove(random);
        }

        System.out.println(allList.size());

    }
}
